package com.wxp.demo04.global;

import android.os.Bundle;
import android.widget.EditText;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;

import com.wxp.demo04.R;

/**
 * 3.1 读取资源文件字符串
 */
public class ReadStringActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_read_string);

        this.setTitle("3.1 读取资源文件字符串");
        //获取strings模板中的字符串
        String devEnv = this.getString(R.string.dev_env);
        String testEnv = this.getString(R.string.test_env);
        String prodEnv = this.getString(R.string.prod_env);

        //更新界面值
        EditText editText = this.findViewById(R.id.show_text);
        editText.setText("dev_env：" + devEnv + "\n"
                + "test_env：" + testEnv + "\n"
                + "prod_env：" + prodEnv + "\n"
        );
    }
}